package com.ggg.clothesshop.mapper;

import com.ggg.clothesshop.model.Orders;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;

public interface OrdersMapper {
    Integer deleteByPrimaryKey(Integer orderid);

    Integer insert(Orders record);

    Integer insertSelective(Orders record);

    Orders selectByPrimaryKey(Integer orderid);

    Integer updateByPrimaryKeySelective(Orders record);

    Integer updateByPrimaryKey(Orders record);

    //取最新几条非购物车的订单数据
    ArrayList<Orders> selectOrdersByUser(@Param("orderNum") int orderNum, @Param("userid") int userid, @Param("orderstatus") String orderstatus);

    //查找是否已存在相同的购物车订单
    Orders selectSameOrder(Orders order);

    //搜索非购物车订单
    ArrayList<Orders> selectByUser(@Param("userid") int userid, @Param("orderstatus") String orderstatus);

    //搜索购物车订单
    ArrayList<Orders> selectCartByUser(@Param("userid") int userid, @Param("orderstatus") String orderstatus);

    //搜索用户购物车的货物数
    Integer selectCartTotal(Orders order);

    //获得上一条插入记录的id
    Integer selectLastInsertId();
}